<!--
 * @Description:
 * @Author: FangYaoTang
 * @Date: 2023-08-16 09:16:36
 * @LastEditor: FangYaoTang
 * @LastEditTime: 2023-09-02 10:19:01
 * @Copyright: by 南京桓羽信息科技有限公司 禁止任何形式（包含二次开发）转售系统源码，违者必究。
-->

<template>
  <view class="CustomNavbar">
    <!-- <u-navbar v-if="left > 0" @leftClick="utils.navBack()" :leftText="lText" :leftIconSize="left" :leftIconColor="color" :title="title" :titleStyle="{ color, fontWeight: 'bold' }" :bgColor="bg" :placeholder="true" /> -->
    <u-navbar
      :titleStyle="{ color, fontWeight: 'bold' }"
      :bgColor="bg"
      :placeholder="true"
      :leftIconSize="left"
      :fixed="isFixed"
    >
      <template #center>
        <view style="height: 100%; width: 100%; position: relative">
          <slot></slot>
        </view>
      </template>
    </u-navbar>
  </view>
</template>

<script>
import tools from '@/common/utils/index.js'
export default {
  name: 'CustomNavbar',
  props: {
    title: {
      // 标题
      type: String,
      default: ''
    },
    bg: {
      // 导航条背景
      type: String,
      default: 'transparent'
    },
    color: {
      // 文字 图标 颜色
      type: String,
      default: '#fff'
    },
    left: {
      // 左侧图标
      type: Number,
      default: 16
    },
    lText: {
      // 左侧文字
      type: String,
      default: ''
    },
    isFixed: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return { utils: tools }
  },
  methods: {
    backHome() {
      uni.switchTab({ url: '/pages/home/index' })
    }
  }
}
</script>

<style lang="scss" scoped>
.CustomNavbar {
  .n_left {
    display: flex;
    align-items: center;
    flex-direction: row;
    margin: 0 -26rpx;

    .back_prev {
      padding-left: 26rpx;
    }

    .back_home {
      padding-right: 26rpx;
    }
  }
}
.main_title {
  margin-left: 50%;
}
</style>
